package com.qf.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.UserDao;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*
 *@Description:
 *@author:刘哥
 *@Date:10:11 2022/7/15
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public List<User> findAll() {
       return userDao.findAll();
    }

    @Override
    public Object findPage(Integer pageNum,Integer pageSize) {
//       调用分页插件(在查询之前)
        PageHelper.startPage(pageNum,pageSize);
//        查询
        Page<User> page =userDao.findPage();
//        封装PageInfo
        PageInfo<User> pageInfo = new PageInfo<>(page);
        System.out.println(pageInfo);
        return pageInfo;
    }
}
